package com.mjlf.jol;

import org.openjdk.jol.info.ClassLayout;

/**
 * @ClassName JolTest1
 * @auther mjlf
 * @Date 2019/7/16 9:38
 * @Description TODO
 */
public class JolTest2 {

    public static void main(String[] args) {
        A a = new A();
        System.out.println("before hash");
        //没有计算hashcode之前的对象头
        System.out.println(ClassLayout.parseInstance(a).toPrintable());
        //jvm计算hashcode
        System.out.println("jvm---------" + Integer.toHexString(a.hashCode()));
        //计算hashcode后
        System.out.println(ClassLayout.parseInstance(a).toPrintable());
        //调用gc
        System.gc();
        System.out.println(ClassLayout.parseInstance(a).toPrintable());
    }
}
